﻿using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using LiveChartsCore;
using LiveChartsCore.Kernel;
using LiveChartsCore.SkiaSharpView;

namespace TestWpfLiveCharts2
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            var se1 = new LineSeries<int>
            {
                Values = new int[] { 4, 6, 5, 3, -3, -1, 2 },
                GeometrySize = 0,
                Fill = null,
                LineSmoothness = 1,
            };

            var se2 = new ColumnSeries<double>
            {
                Values = new double[] { 2, 5, 4, -2, 4, -3, 5 },
                //Fill=  null,
            };

            lineChart.Series = new ISeries[] { se1, se2 };
        }

        private void LineChart_DataPointerDown(LiveChartsCore.Kernel.Sketches.IChartView chart, IEnumerable<ChartPoint> points)
        {
            string value = string.Join(", ", points.Select(dd => dd.PrimaryValue));
            Trace.TraceInformation($"LineChart_DataPointerDown {value}");
        }

        private void LineChart_ChartPointPointerDown(LiveChartsCore.Kernel.Sketches.IChartView chart, ChartPoint point)
        {
            if (point is null) return;

            Trace.TraceInformation($"LineChart_ChartPointPointerDown {point.PrimaryValue}");
            var a = point.Context;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var win = new Window1();
            win.Show();
        }

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var a = e.Source;
        }
    }
}